package com.nstar.carousel.utils
{
	import mx.effects.Effect;
	
	import org.efflex.mx.viewStackEffects.CoverFlowPapervision3D;
	import org.efflex.mx.viewStackEffects.CubePapervision3D;
	import org.efflex.mx.viewStackEffects.Fade;
	import org.efflex.mx.viewStackEffects.FadeZoom;
	import org.efflex.mx.viewStackEffects.Flint2D;
	import org.efflex.mx.viewStackEffects.FlipPapervision3D;
	import org.efflex.mx.viewStackEffects.Grid;
	import org.efflex.mx.viewStackEffects.GridZoom;
	import org.efflex.mx.viewStackEffects.List;
	import org.efflex.mx.viewStackEffects.Pixelate;
	import org.efflex.mx.viewStackEffects.Slide;
	import org.efflex.mx.viewStackEffects.Squash;
	
	public class CarouselEffectUtils
	{
		public static const EFFECT_COVER_FLOW_PAPERVISION3D:String = "CoverFlowPapervision3D";
		public static const EFFECT_CUBE_PAPERVISION3D:String = "CubePapervision3D";
		public static const EFFECT_FADE:String = "Fade";
		public static const EFFECT_FADE_TILE:String = "FadeTile";
		public static const EFFECT_FADE_ZOOM:String = "FadeZoom";
		public static const EFFECT_FLINT2D:String = "Flint2D";
		public static const EFFECT_FLIP_PAPERVISION3D:String = "FlipPapervision3D";
		public static const EFFECT_FLIP_PAPERVISION3D_TILE:String = "FlipPapervision3DTile";
		public static const EFFECT_GRID:String = "Grid";
		public static const EFFECT_GRID_ZOOM:String = "GridZoom";
		public static const EFFECT_LIST:String = "List";
		public static const EFFECT_MOVIE_CLIP_MASK:String = "MovieClipMask";
		public static const EFFECT_PIXELATE:String = "Pixelate";
		public static const EFFECT_SLIDE:String = "Slide";
		public static const EFFECT_SQUASH:String = "Squash";
		public static const EFFECT_TILE_MASK:String = "TileMask";
		
				
		public function CarouselEffectUtils()
		{
		}
		
		//创建效果
		public static function createEffect(effectType:String):Effect{
			var effect:Effect = null;
			switch(effectType){
				case EFFECT_COVER_FLOW_PAPERVISION3D:
					effect = new CoverFlowPapervision3D();
					break;
				case EFFECT_CUBE_PAPERVISION3D:
					effect = new CubePapervision3D();
					break;
				case EFFECT_FADE:
					effect = new Fade();
					break;
				case EFFECT_FADE_TILE://flex3未实现
					break;
				case EFFECT_FADE_ZOOM:
					effect = new FadeZoom();
					break;
				case EFFECT_FLINT2D:
					effect = new Flint2D();
					break;
				case EFFECT_FLIP_PAPERVISION3D:
					effect = new FlipPapervision3D();
					break;
				case EFFECT_FLIP_PAPERVISION3D_TILE://flex3未实现
					break;
				case EFFECT_GRID:
					effect = new Grid();
					break;
				case EFFECT_GRID_ZOOM:
					effect = new GridZoom();
					break;
				case EFFECT_LIST:
					effect = new List();
					break;
				case EFFECT_MOVIE_CLIP_MASK://flex3未实现
					break;
				case EFFECT_PIXELATE:
					effect = new Pixelate();
					break;
				case EFFECT_SLIDE:
					effect = new Slide();
					break;
				case EFFECT_SQUASH:
					effect = new Squash();
					break;
				case EFFECT_TILE_MASK://flex3未实现
					break;
			}
			
			return effect;
		}
		
		//更新效果的方向，适用效果如下
		//CoverFlowPapervision3D,CubePapervision3D,
		//FlipPapervision3D,FlipPapervision3DTile,List,Slide,Squash
		public static function updateDriection(effect:Object,direction:String):void{
			effect.direction = direction;
		}
		//更新Tile类效果的属性，适用以下效果
		//FadeTile,FlipPapervision3DTile,TileMask
		public static function updateTile(effect:Object,rows:int,cols:int):void{
			effect.numRows = rows;
			effect.numCols = cols;
		}
	}
}